-
{
posts.map((post) => (
-
{post.data.title}
))
}
--- import BaseHead from "../../../components/BaseHead.astro"; import Header from "../../../components/Header.astro"; import Footer from "../../../components/Footer.astro"; import { SITE_TITLE, SITE_DESCRIPTION } from "../../../consts"; import { getCollection } from "astro:content"; import FormattedDate from "../../../components/FormattedDate.astro"; export async function getStaticPaths() { const blogs = await getCollection("blog"); const events = Object.keys( Object.groupBy( blogs.map((b) => ({ id: b.id, event: b.id.split("/").at(-2) || "", })), (b) => b.event ) ); console.log(events); return events.filter((e) => e).map((event) => ({ params: { event } })); } const event = Astro.params.event; const blogs = await getCollection("blog"); const posts = blogs .filter((b) => b.id.includes(event + "/")) .sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()); ---